// #define print(...)
class Solution {
public:
    int maxArea(vector<int>& height) {
        auto front = height.begin(),
            back = front + height.size() - 1;
        long res = 0;
        while(front<back){
            auto a = (back-front)*(*front<*back ? *front++ : *back--);
            if(res < a) res = a;
        }
        return (int)res;
    }
};
